package com.jixiantubu.tupianlunbo;

import java.util.List;
import com.jixiantubu.bean.TupianBean;
import com.jixiantubu.util.MyApplication;
import com.lidroid.xutils.BitmapUtils;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout.LayoutParams;

public class MyPagerAdapter_fx extends PagerAdapter {
	List<TupianBean> list;
	Context context;
	BitmapUtils bitmapUtils;
    ViewPager viewPager;
    private BitmapUtils bitmaputils;
    private List<ZoomImageView_fx> ziv_view;
	public MyPagerAdapter_fx(Context context, List<TupianBean> list) {
		bitmaputils = new BitmapUtils(context);
		this.list=list;
	}

	@Override
	public int getCount() {
		return list.size();
	}
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		ZoomImageView_fx view = new ZoomImageView_fx(container.getContext());
		String url = "http://" + MyApplication.getIP() + ":8080/Jinnang/img/"
				+ list.get(position).getPl_path();//网络图片路径
		bitmaputils.display(view, url);
		container.addView(view, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
		return view;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView((View) object);
	}

	@Override
	public boolean isViewFromObject(View view, Object obj) {
		return view == obj;
	}
}
